remotemanager.connection.computers.computer module

class remotemanager.connection.computers.computer.Computer(template: str | None = None, template_path: str | None = None, **kwargs)[source]

Combo class that allows for connection to a machine and generating jobscripts

pack(collect_values: bool = True, ignore_none: bool = True, prune_defaults: bool = True, *args, **kwargs) dict[source]

Package up this Computer to a dictionary that can be stored as a yaml file.

A note on collection: The collected values are explicitly stated in package_collect. Automated collection is possible, but not feasible for “human readable” outputs

__dict__ collects the internal variables So instead of user, you get the _conn dictionary

Using dir() is an option, but collects far too many variables, and also has the possibility to accidentally call functions as it crawls the object

Parameters:
  • collect_values (bool) – Also collect any stored values if True. Defaults to True.

  • ignore_none (bool) – skip any None values in serialisation. Defaults to True.

  • prune_defaults (bool) – Collects only non-default values if True. Defaults to True.

Returns:

serialised output

Return type:

dict

classmethod unpack(data: dict, **kwargs) Computer[source]

Re-create an object from a packaged payload coming from obj.pack

Note

use this function to unpack from a payload _outside_ an object

newobj = MyObject.unpack(payload)

Where MyObject is a subclass of SendableMixin, and payload is a dict-type coming from MyObject.pack()

Parameters:
  • data (dict) – __dict__ payload from the object that was packaged

  • file (str) – filepath to unpack from, if data is not given

  • limit (bool) – set False to allow outside classes to be unserialised

Returns:

re-created object

to_yaml(file: str = None, **kwargs) None | str[source]

Dump the computer to yaml. Returns the yaml content as a string if file is None